package com.gorkr.hot100.simple;

import java.util.HashMap;

/**
 * @author gorkr
 * @date 2022/03/15 01:28
 * 只出现一次的数字
 **/
public class L136 {
    public int singleNumber(int[] nums) {

        HashMap<Integer,Integer> map = new HashMap<>();
        for (int i = 0; i < nums.length; i++) {
            if(map.containsKey(nums[i])){
                map.remove(nums[i]);
            }else {
                map.put(nums[i],1);
            }
        }
        return (int)(map.keySet().toArray()[0]);
    }
}
    